package org.tis.tools.abf.module.jnl.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.tis.tools.abf.module.jnl.service.IEntryDataService;
import org.tis.tools.core.web.controller.BaseController;
import org.tis.tools.model.common.ResultVO;

import javax.validation.constraints.NotBlank;

/**
 * 对外服务提供
 *
 * 查询指定表中的指定对象信息
 * Created by chenchao
 * Created on 2018/10/30 10:04
 */
@RestController
@RequestMapping("/v1/api/entryData")
@Validated
public class EntryDataApiController extends BaseController {

    @Autowired
    private IEntryDataService logDataService;

    @ApiOperation(value = "根据GUID和类名查数据对象",notes = "传入操作的数据记录的guid和className作为参数")
    @GetMapping("/{id}/getEntity/{className}")
    public ResultVO getEntity(@PathVariable("id") @NotBlank(message = "数据记录的GUID不能为空") String id, @PathVariable("className") @NotBlank(message = "数据记录的类名不能为空") String className) throws Exception {
        return ResultVO.success("查询成功",logDataService.getEntity(id,className));
    }
}
